<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@include file="/view/inc/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<security:csrfMetaTags/>
<script type="text/javascript" src="${basepath}static/js/md5.js"></script>
<script type="text/javascript">
var _callbacks = $.Callbacks();
function initUpdatePwd(paramOpts){
	_callbacks.add(paramOpts.callBack);
	$('#cloBtn').on('click',function(){
		paramOpts.dialog.close();
	});
}

/**
 * 保存密码
 * @returns {boolean}
 */
function submitUpdatePwd(){
	if($("#password1").textbox("getValue")!=$("#password2").textbox("getValue")){
		$.messager.alert('提示','两次输入密码不一致','info');
		return false;
	}
	if(!$('#updatepwdform').form('enableValidation').form('validate')){
		return;
	}
	var url=basepath+'sys/saveUpdatePwd';
	url=SKY.urlCSRF(url);
	var data = new Object();
	data.password=hex_md5($("#password").textbox('getValue'));
	data.password1=hex_md5($("#password1").textbox('getValue'));
	data.password2=hex_md5($("#password2").textbox('getValue'));
	SKY_EASYUI.mask("正在修改,请稍等...");
	$.ajax({
		url:url,
		type: "POST",
		data:data,
		dataType:'json',
		success:function(data){
			SKY_EASYUI.unmask();
			if(data.code != '0'){
				_callbacks.fire();
			}else{
				$.messager.alert('提示',data.name,'error');
			}
		}
	});
}
</script> 
</head>
<body>
<div class="easyui-panel"  style="width:100%;height:100%;text-align: center;"
	 data-options="footer:'#updateButtonsFt',border:false">
		<form id="updatepwdform" class="easyui-form" method="post"
			data-options="novalidate:true">
			<table style="width:100%">
				<tr>
					<th><label>原密码:</label></th>
					<td><input class="easyui-passwordbox" name="password" id="password"
						data-options="required:true"></input></td>
				</tr>
				<tr>
					<th><label>新密码:</label></th>
					<td><input class="easyui-passwordbox" name="password1" id="password1"
						data-options="required:true,
									  validType:['length[6,10]']"></input></td>
				</tr>
				<tr>
					<th><label>确认密码:</label></th>
					<td><input class="easyui-passwordbox" name="password2" id="password2"
							   data-options="required:true"></input></td>
				</tr>
			</table>
		</form>
</div>
<div id='updateButtonsFt' style="text-align:center; padding:0px; top:0px">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls='icon-save'
		onclick="submitUpdatePwd()">修改</a>
	<a href="javascript:void(0)" id='cloBtn' class="easyui-linkbutton" iconCls='icon-cancel'>取消</a>
</div>
</body>
</html>